package lxt.action.core;

import java.util.Calendar;
import java.util.Date;

public class DateUtil {
	/**
	 * 判断给定日期与今天相差几天
	 */
	public static int getDays(Date end) {
		try {
			Calendar ca = Calendar.getInstance();
			//获取当前时间在一年中的第几天
			int day = ca.get(Calendar.DAY_OF_YEAR);
			
			ca.setTime(end);
			return ca.get(Calendar.DAY_OF_YEAR) - day;
		} catch (Exception e) {
			e.printStackTrace();
			return -1;
		}
	}
}
